import React, { Component } from "react";
import { connect } from "react-redux";
import { Icon, Row, Col, Input, Spin, Checkbox } from "antd";
import { messages, deepFullCopy } from "share/common";
import Condition from "components/condition";
import noInvoiceImg from "images/financial-management/file-audit/no-invoice.png";
import auditService from "../finance-audit.service";
import expenseService from "containers/my-account/expense.service";
import myAccountFunction from "containers/my-account/my-account.function";

const { If, Else, ElseIf } = Condition;
const { isFieldDisabled } = myAccountFunction;

class InvoiceNotMatched extends Component {
  state = {
    visible: false,
    financeReceipts: [],
    withReceipt: [],
    isFinanceAdd: true, //是否为财务扫描添加的发票
    selectedId: "",
    lastModifyReceipt: {}, //最新修改的发票，之前修改的发票都在check
    checkingList: [], //正在check的发票列表
    checkFailedList: [], //匹配失败的发票
    counterList: [], //匹配成功的发票倒计时
    checkboxKeys: [], //复选框选中的key
  };

  componentDidMount() {
    if (window.addEventListener) {
      window.addEventListener("keyup", this.handleKeyUp);
    } else {
      window.attachEvent("onkeyup", this.handleKeyUp);
    }
    this.setStateValues(this.props);
  }

  componentWillReceiveProps(nextProps) {
    const {
      checkCounterList,
      notMatchedInfo: { notMatchedNum, toBeCheckedNum },
    } = nextProps;
    let { counterList, financeReceipts, withReceipt } = this.state;
    if (nextProps.visible && !this.state.visible) {
      this.setStateValues(nextProps);
    }
    if (
      checkCounterList.length > 0 &&
      this.props.checkCounterList.length === 0
    ) {
      let num = notMatchedNum;
      checkCounterList.map((id) => {
        [financeReceipts, withReceipt].map((list) =>
          list.map((item) => {
            if (item.id === id) {
              num--;
              item.checkTag = "CHECKED";
              this.checkSuccessCounter(item);
            }
          })
        );
      });
      this.setState({
        counterList,
        financeReceipts,
        withReceipt,
        checkboxKeys: [],
      });
      this.props.onCheckKeysChange([]);
      this.props.onCheckSuccess(num, toBeCheckedNum);
    }
  }

  componentWillUnmount() {
    if (window.addEventListener) {
      window.removeEventListener("keyup", this.handleKeyUp);
    } else {
      window.detachEvent("onkeyup", this.handleKeyUp);
    }
  }

  setStateValues = (props) => {
    const {
      notMatchedInfo: { financeReceipt = [], withReceipt = [] },
    } = props;
    this.setState(
      {
        visible: props.visible,
        financeReceipts: deepFullCopy(financeReceipt),
        withReceipt: deepFullCopy(withReceipt),
        isFinanceAdd: financeReceipt.length > 0,
        selectedId: (financeReceipt[0] || {}).id || (withReceipt[0] || {}).id,
      },
      this.focusInput
    );
  };

  focusInput = () => {
    setTimeout(() => {
      if (this.input) {
        this.input.focus();
      } else if (this.defaultInput) {
        this.defaultInput.focus();
      }
    }, 100);
  };

  //键盘事件
  handleKeyUp = (e) => {
    e.stopPropagation();
    const { visible, noticeVisible } = this.props;
    const {
      isFinanceAdd,
      selectedId,
      checkingList,
      financeReceipts,
      withReceipt,
    } = this.state;
    let selectedIndex = 0,
      nextIndex = 0;
    if (isFinanceAdd) {
      financeReceipts.map(
        (item, index) => item.id === selectedId && (selectedIndex = index)
      );
    } else {
      withReceipt.map(
        (item, index) => item.id === selectedId && (selectedIndex = index)
      );
    }
    if (visible && !noticeVisible) {
      switch (e.keyCode) {
        //回车 DOWN
        case 13:
        case 40:
          if (isFinanceAdd) {
            if (selectedIndex < financeReceipts.length - 1) {
              nextIndex =
                this.getNextReceiptIndex(
                  financeReceipts,
                  selectedIndex + 1,
                  true
                ) || selectedIndex;
              this.handleSelectReceipt(
                financeReceipts[nextIndex],
                nextIndex,
                nextIndex !== selectedIndex
              );
            } else if (
              selectedIndex === financeReceipts.length - 1 &&
              !checkingList.some((item) => !item.invoiceOID) &&
              withReceipt.length > 0
            ) {
              nextIndex = this.getNextReceiptIndex(withReceipt, 0, true);
              !nextIndex && nextIndex !== 0 && (nextIndex = selectedIndex);
              this.handleSelectReceipt(withReceipt[nextIndex] || {}, nextIndex);
            } else {
              this.handleSelectReceipt({}, selectedIndex, false);
            }
          } else {
            if (selectedIndex < withReceipt.length - 1) {
              nextIndex = this.getNextReceiptIndex(
                withReceipt,
                selectedIndex + 1,
                true
              );
              this.handleSelectReceipt(
                nextIndex ? withReceipt[nextIndex] : {},
                nextIndex,
                !!nextIndex
              );
            } else {
              this.handleSelectReceipt(
                { invoiceOID: true },
                selectedIndex,
                false
              );
            }
          }
          break;
        //UP
        case 38:
          if (isFinanceAdd) {
            if (selectedIndex > 0) {
              nextIndex = this.getNextReceiptIndex(
                financeReceipts,
                selectedIndex - 1
              );
              (nextIndex || nextIndex === 0) &&
                this.handleSelectReceipt(financeReceipts[nextIndex], nextIndex);
            }
          } else {
            if (
              selectedIndex === 0 &&
              !checkingList.some((item) => item.invoiceOID) &&
              financeReceipts.length > 0
            ) {
              nextIndex = this.getNextReceiptIndex(
                financeReceipts,
                financeReceipts.length - 1
              );
              (nextIndex || nextIndex === 0) &&
                this.handleSelectReceipt(financeReceipts[nextIndex], nextIndex);
            }
            if (selectedIndex > 0) {
              nextIndex = this.getNextReceiptIndex(
                withReceipt,
                selectedIndex - 1
              );
              (nextIndex || nextIndex === 0) &&
                this.handleSelectReceipt(withReceipt[nextIndex], nextIndex);
            }
          }
          break;
      }
    }
  };

  //获取下一张／上一张发票的index
  getNextReceiptIndex = (list, index, isNext) => {
    const { checkingList } = this.state;
    if (checkingList.length === 0 && list[index]) {
      return index;
    }
    if (isNext) {
      for (let i = index; i < list.length; i++) {
        for (let j = 0; j < checkingList.length; j++) {
          if (checkingList[j].id !== list[i].id) {
            return i;
          }
        }
      }
    } else {
      for (let i = index; i >= 0; i--) {
        for (let j = 0; j < checkingList.length; j++) {
          if (checkingList[j].id !== list[i].id) {
            return i;
          }
        }
      }
    }
    return false;
  };

  //检查发票代码、号码是否被更改
  checkIsChange = () => {
    let {
      financeReceipts,
      withReceipt,
      lastModifyReceipt,
      selectedId,
      checkFailedList,
    } = this.state;
    const { billingCode, billingNo } = lastModifyReceipt;
    let isFinanceReceipt = !lastModifyReceipt.invoiceOID;
    let originReceipt = isFinanceReceipt
      ? deepFullCopy(
          financeReceipts.filter((item) => item.id === selectedId)[0]
        )
      : deepFullCopy(withReceipt.filter((item) => item.id === selectedId)[0]);
    if (!(originReceipt && originReceipt.id)) return false;
    let hasChange =
      billingCode !== originReceipt.billingCode ||
      billingNo !== originReceipt.billingNo;
    if (hasChange) {
      if (!billingCode && !billingNo) {
        lastModifyReceipt.noticeInfo = messages(
          "expense-14.key169"
        ) /*请先输入发票代码／号码*/;
        hasChange = false;
        checkFailedList.deleteObj(lastModifyReceipt, "id");
      }
      if (billingCode && !/^[\d\w]+$/.test(billingCode)) {
        lastModifyReceipt.noticeInfo = messages(
          "expense-14.key170"
        ) /*请输入字母或数字*/;
        hasChange = false;
        checkFailedList.deleteObj(lastModifyReceipt, "id");
      }
      this.refreshList(lastModifyReceipt);
      this.setState({ checkFailedList });
    }
    return hasChange;
  };

  refreshList = (receipt) => {
    let { financeReceipts, withReceipt, selectedId } = this.state;
    let selectedIndex = 0;
    receipt.invoiceOID &&
      withReceipt.map((item, index) => {
        if (item.id === receipt.id) {
          withReceipt[index] = deepFullCopy(receipt);
          selectedIndex = index;
        }
        receipt.hideReceipt && withReceipt.deleteObj(receipt, "id");
      });
    !receipt.invoiceOID &&
      financeReceipts.map((item, index) => {
        if (item.id === receipt.id) {
          financeReceipts[index] = deepFullCopy(receipt);
          selectedIndex = index;
        }
        receipt.hideReceipt && financeReceipts.deleteObj(receipt, "id");
      });
    //若当前选中的发票消失，则选中下一张发票
    if (receipt.id === selectedId && receipt.hideReceipt) {
      if (receipt.invoiceOID) {
        if (withReceipt[selectedIndex]) {
          this.handleSelectReceipt(
            withReceipt[selectedIndex],
            selectedIndex,
            false
          );
        } else if (financeReceipts[0]) {
          this.handleSelectReceipt(financeReceipts[0], 0, false);
        } else {
          this.handleSelectReceipt(withReceipt[0], 0, false);
        }
      } else {
        if (financeReceipts[selectedIndex]) {
          this.handleSelectReceipt(
            financeReceipts[selectedIndex],
            selectedIndex,
            false
          );
        } else if (withReceipt[0]) {
          this.handleSelectReceipt(withReceipt[0], 0, false);
        } else {
          this.handleSelectReceipt(financeReceipts[0], 0, false);
        }
      }
    }
    this.setState({ financeReceipts, withReceipt }, this.focusInput);
  };

  //处理匹配失败的情况（包括发票查验、保存、匹配）
  handleCheckFailed = (receipt) => {
    let { checkingList, checkFailedList } = this.state;
    checkingList.deleteObj(receipt, "id");
    !checkFailedList.some((item) => item.id === receipt.id) &&
      checkFailedList.push(receipt);
    receipt.noticeInfo = messages("expense-14.key171") /*未找到匹配发票*/;
    this.refreshList(receipt);
    this.setState({ checkingList, checkFailedList });
  };

  //匹配成功的发票倒计时
  checkSuccessCounter = (receipt) => {
    let { counterList } = this.state;
    if (receipt.checkTag !== "NOT_MATCHED" || receipt.containsInvoiceFree) {
      counterList.push({ id: receipt.id, counter: 2 });
      let interval = setInterval(() => {
        counterList.map((item) => item.id === receipt.id && item.counter--);
        this.setState({ counterList });
        if (!counterList.filter((item) => item.id === receipt.id)[0].counter) {
          clearInterval(interval);
          receipt.hideReceipt = true;
          this.refreshList(receipt);
        }
      }, 1000);
    }
  };

  //发票查验
  handleVerify = (receipt) => {
    const { user, entityID, entityOID, entityType } = this.props;
    let type = receipt.invoiceOID
      ? "invoice"
      : entityType === 5001
      ? "bag"
      : "expense_report";
    let expenseReportOID = entityType === 5001 ? "" : entityOID;
    let isFinancialOperateType = true;
    let isInvoiceFromFinancialEntry = !!type && type !== "invoice";
    expenseService
      .testInvoice(
        receipt,
        user.userOID,
        type,
        entityID,
        expenseReportOID,
        isFinancialOperateType,
        isInvoiceFromFinancialEntry
      )
      .then((res) => {
        this.handleSave(res.data.invoiceInfo);
      })
      .catch(() => {
        this.handleCheckFailed(receipt);
      });
  };

  //发票保存
  handleSave = (receipt) => {
    const { entityID, entityType } = this.props;
    let type = receipt.invoiceOID
      ? ""
      : entityType === 5001
      ? "bag"
      : "expense_report";
    receipt.updateCheckResult = false;
    expenseService
      .financialAuditInvoice(receipt, type, entityID)
      .then((res) => {
        this.handleCheck(res.data.rows);
      })
      .catch(() => {
        this.handleCheckFailed(receipt);
      });
  };

  handleCheck = (receipt) => {
    let {
      entityOID,
      entityType,
      notMatchedInfo: { notMatchedNum, toBeCheckedNum },
    } = this.props;
    let {
      financeReceipts,
      withReceipt,
      checkingList,
      checkFailedList,
    } = this.state;
    let params = {
      receiptList: [receipt.id],
      type: "NOT_MATCHED",
      entityType,
      entityCode: entityOID,
    };
    auditService
      .manualCheck(params, entityType)
      .then((res) => {
        let notMatchedIds = [];
        Object.keys(res.data.notMatchedId).map((id) => {
          notMatchedIds.push(id);
          notMatchedIds.push(...res.data.notMatchedId[id]);
        });
        notMatchedIds.map((id) => {
          let receipt = financeReceipts
            .concat(withReceipt)
            .filter((item) => item.id === id)[0];
          receipt.checkTag = res.data.checkTag;
          checkingList.deleteObj(receipt, "id");
          //发票变为免贴票，无需核对
          if (res.data.containsInvoiceFree) {
            receipt.containsInvoiceFree = true;
            this.checkSuccessCounter(receipt);
            checkFailedList.deleteObj(receipt, "id");
          } else if (~["TO_BE_CHECKED", "CHECKED"].indexOf(res.data.checkTag)) {
            //匹配成功
            notMatchedNum--;
            this.checkSuccessCounter(receipt);
            checkFailedList.deleteObj(receipt, "id");
          } else {
            !checkFailedList.some((item) => item.id === id) &&
              checkFailedList.push(receipt);
            receipt.noticeInfo = messages(
              "expense-14.key171"
            ) /*未找到匹配发票*/;
          }
          this.refreshList(receipt);
          this.setState({ checkingList, checkFailedList });
        });
        !res.data.containsInvoiceFree &&
          res.data.checkTag === "TO_BE_CHECKED" &&
          toBeCheckedNum++;
        this.props.onCheckSuccess(notMatchedNum, toBeCheckedNum);
      })
      .catch(() => {
        this.handleCheckFailed(receipt);
      });
  };

  handleSelectReceipt = (receipt = {}, index, needFocus = true) => {
    let { checkingList, lastModifyReceipt, selectedId } = this.state;
    if (lastModifyReceipt.id !== receipt.id && this.checkIsChange()) {
      checkingList.push(lastModifyReceipt);
      this.setState({ checkingList });
      this.handleVerify(lastModifyReceipt);
    }
    this.setState(
      {
        isFinanceAdd: !receipt.invoiceOID,
        selectedId: receipt.id || selectedId,
        lastModifyReceipt:
          receipt.id && lastModifyReceipt.id !== receipt.id
            ? deepFullCopy(receipt)
            : lastModifyReceipt,
      },
      () => {
        needFocus && this.focusInput();
        receipt.id && this.props.onSelect(receipt);
      }
    );
  };

  handleChangeReceipt = (type, value) => {
    let { lastModifyReceipt } = this.state;
    lastModifyReceipt[type] = value;
    this.setState({ lastModifyReceipt });
  };

  handleCheckboxChange = (e, list) => {
    let { checkboxKeys } = this.state;
    list.map((item) => {
      if (e.target.checked) {
        !checkboxKeys.includes(item.id) && checkboxKeys.push(item.id);
      } else {
        checkboxKeys.delete(item.id);
      }
    });
    this.setState({ checkboxKeys });
    this.props.onCheckKeysChange(checkboxKeys);
  };

  renderInput = (type, receipt, index, isFinanceAdd) => {
    console.log('renderInput', {receipt, type, defaultValue: receipt[type]})
    try {
      const { selectedId, checkingList } = this.state;
      const auditBaseConfig = this.props.options.auditBaseConfig || {
        reviewEditSuitable: true,
        reviewEditEnable: true,
      };
      const isSelectedItem = receipt.id === selectedId;
      let disabled =
        (checkingList[0] &&
          !!checkingList[0].invoiceOID !== !!receipt.invoiceOID) ||
        isFieldDisabled(
          receipt,
          type === "billingCode" ? "invoiceCode" : "invoiceNumber",
          "auditCheck"
        ) ||
        (receipt.checkResult === "R_0000" && !receipt.alipayOrWeChat) ||
        (!isFinanceAdd &&
          !(
            auditBaseConfig.reviewEditSuitable &&
            auditBaseConfig.reviewEditEnable
          ));
      return (
        <Row>
          <Col
            span={7}
            className="invoice-manual-check-left-content-match-item-label"
          >
            {
              type === "billingCode"
                ? messages("expense-14.key172") /*发票代码*/
                : messages("expense-14.key173") /*发票号码*/
            }
          </Col>
          <Col span={16}>
            <Input
              key={receipt.id}
              size="small"
              placeholder={messages("expense-14.key174") /*请输入temp2*/}
              // disabled={disabled}
              defaultValue={receipt[type]}
              maxLength="50"
              ref={
                isSelectedItem && type === "billingCode" && !disabled
                  ? (input) => (this.input = input)
                  : () => {}
              }
              onFocus={() => this.handleSelectReceipt(receipt, index, false)}
              onChange={(e) => this.handleChangeReceipt(type, e.target.value)}
            />
          </Col>
        </Row>
      );
    } catch (e) {
      return e.message;
    }
  };

  renderItem = (receipt, index, isFinanceAdd) => {
    console.log("renderItem", { receipt, index, isFinanceAdd });
    const { selectedId, checkingList, counterList, checkboxKeys } = this.state;
    //财务添加的发票没有关联费用
    const isSelectedItem = receipt.id === selectedId;
    let counter = (
      counterList.filter((item) => item.id === receipt.id)[0] || {}
    ).counter;
    let checkTagName = "";
    if (receipt.containsInvoiceFree) {
      checkTagName = messages("common.invoice.free"); /*免贴票*/
    } else if (receipt.checkTag === "TO_BE_CHECKED") {
      checkTagName = messages("expense-14.key175"); /*待核对*/
    } else {
      checkTagName = messages("expense-14.key17"); /*已核对*/
    }

    return (
      <Row style={{ margin: "8px 20px" }}>
        <Col span={4} className="col-left-checkbox">
          <div style={{ lineHeight: "50px" }}>
            <Checkbox
              checked={checkboxKeys.includes(receipt.id)}
              onChange={(e) => this.handleCheckboxChange(e, [receipt])}
            />
          </div>
        </Col>
        <Col span={20} className="col-right-content">
          {(() => {
            if (checkingList.some((item) => item.id === receipt.id)) {
              return (
                <Row className="invoice-manual-check-left-content-match-item">
                  <Spin size="small">
                    <Col
                      span={12}
                      className="invoice-manual-check-left-content-match-item-content"
                    >
                      <span className="invoice-manual-check-left-content-match-item-label">
                        {messages("expense-14.key172") /*发票代码*/}
                      </span>
                      &nbsp;
                      {receipt.billingCode}
                    </Col>
                    <Col
                      span={12}
                      className="invoice-manual-check-left-content-match-item-content"
                    >
                      <span className="invoice-manual-check-left-content-match-item-label">
                        {messages("expense-14.key173") /*发票号码*/}
                      </span>
                      &nbsp;
                      {receipt.billingNo}
                    </Col>
                  </Spin>
                </Row>
              );
            }

            if (
              ~["TO_BE_CHECKED", "CHECKED"].indexOf(receipt.checkTag) ||
              receipt.containsInvoiceFree
            ) {
              return (
                <Row className="invoice-manual-check-left-content-match-item match-success">
                  <Icon type="check-circle" />
                  <span className="match-success-title">
                    {
                      receipt.containsInvoiceFree
                        ? messages("expense-14.key176") /*免贴票发票无需核对*/
                        : messages("expense-14.key177") /*发票匹配正确*/
                    }
                  </span>
                  {
                    messages("expense-14.key178", {
                      arg1: counter,
                      arg2: checkTagName,
                    }) /*{arg1}S后移动至【{arg2}】分类中*/
                  }
                </Row>
              );
            }

            return (
              <div
                className={`invoice-manual-check-left-content-match-item ${
                  isSelectedItem ? "item-selected" : ""
                }`}
                onClick={() => this.handleSelectReceipt(receipt, index, false)}
              >
                {isSelectedItem && (
                  <Input
                    style={{ opacity: 0, position: "absolute" }}
                    ref={(input) => (this.defaultInput = input)}
                  />
                )}
                <Row>
                  <Col span={12}>
                    {this.renderInput(
                      "billingCode",
                      receipt,
                      index,
                      isFinanceAdd
                    )}
                  </Col>
                  <Col span={12}>
                    {this.renderInput(
                      "billingNo",
                      receipt,
                      index,
                      isFinanceAdd
                    )}
                  </Col>
                </Row>
                {receipt.noticeInfo && (
                  <div className="invoice-manual-check-left-content-match-item-notice">
                    <Icon type="exclamation-circle-o" /> {receipt.noticeInfo}
                  </div>
                )}
              </div>
            );
          })()}
        </Col>
      </Row>
    );
  };

  renderList = (list, isFinanceAdd) => {
    const { visible } = this.props;
    const {
      financeReceipts,
      withReceipt,
      checkFailedList,
      checkboxKeys,
    } = this.state;
    let showNumber =
      list.length === 0
        ? ""
        : messages("expense-14.key179", { arg1: list.length }); /*共{arg1}张*/
    let isAllCheckFail =
      checkFailedList.length === financeReceipts.length + withReceipt.length;
    if (
      isFinanceAdd &&
      list.length > 0 &&
      (withReceipt.length === 0 || isAllCheckFail)
    ) {
      showNumber = (
        <span style={{ color: "#FA6478" }}>
          {
            messages("expense-14.key180", {
              arg1: list.length,
            }) /*多交{arg1}张，建议立即通知*/
          }
        </span>
      );
    }
    if (
      !isFinanceAdd &&
      list.length > 0 &&
      (financeReceipts.length === 0 || isAllCheckFail)
    ) {
      showNumber = (
        <span style={{ color: "#FA6478" }}>
          {
            messages("expense-14.key181", {
              arg1: list.length,
            }) /*少交{arg1}张，建议暂挂并通知*/
          }
        </span>
      );
    }
    const listIsSelected = list.map((item) => checkboxKeys.includes(item.id));

    return (
      <div>
        <Row className="invoice-manual-check-left-content-list-header">
          <Col span={4} className="col-left-checkbox">
            {list.length > 0 && (
              <Checkbox
                checked={!listIsSelected.includes(false)}
                indeterminate={
                  listIsSelected.includes(true) &&
                  listIsSelected.includes(false)
                }
                onChange={(e) => this.handleCheckboxChange(e, list)}
              />
            )}
          </Col>
          <Col span={20} className="col-right-content">
            {
              isFinanceAdd
                ? messages("expense-14.key182") /*财务扫描发票*/
                : messages("expense-14.key183") /*员工录入发票（需贴票）*/
            }
            <div className="invoice-manual-check-left-content-list-header-count">
              {showNumber}
            </div>
          </Col>
        </Row>

        {list.length > 0 ? (
          list.map((item, index) => {
            return this.renderItem(item, index, isFinanceAdd);
          })
        ) : (
          <Spin spinning={!visible}>
            <Row>
              <Col span={4} className="col-left-checkbox" />
              <Col span={20} className="col-right-content">
                <div className="invoice-manual-check-left-content-empty">
                  <img
                    src={noInvoiceImg}
                    className="invoice-manual-check-left-content-empty-img"
                  />
                  {messages("expense-14.key184") /*无发票*/}
                </div>
              </Col>
            </Row>
          </Spin>
        )}
      </div>
    );
  };

  render() {
    const { financeReceipts, withReceipt } = this.state;
    return (
      <div className="invoice-manual-check-left-content-matched">
        <div className="invoice-manual-check-left-content-alert">
          <span className="invoice-manual-check-left-content-alert-index">
            1
          </span>{" "}
          {messages("expense-14.key185") /*检查发票代码/号码*/}
          <Icon type="arrow-right" />
          <span className="invoice-manual-check-left-content-alert-index">
            2
          </span>{" "}
          {messages("expense-14.key186") /*通知员工或单据暂挂*/}
        </div>
        {this.renderList(deepFullCopy(financeReceipts), true)}
        {this.renderList(deepFullCopy(withReceipt), false)}
      </div>
    );
  }
}

InvoiceNotMatched.propTypes = {
  visible: React.PropTypes.bool,
  entityID: React.PropTypes.oneOfType([
    React.PropTypes.number,
    React.PropTypes.string,
  ]),
  entityOID: React.PropTypes.string,
  entityType: React.PropTypes.number,
  notMatchedInfo: React.PropTypes.object,
  onSelect: React.PropTypes.func,
  onCheckSuccess: React.PropTypes.func,
};

InvoiceNotMatched.defaultProps = {};

function mapStateToProps(state) {
  return {
    user: state.login.user,
    options: state.login.options,
  };
}

export default connect(mapStateToProps)(InvoiceNotMatched);
